/**************************************************************************
Step 1. Include necessary header files such that the stuff your test logic needs is declared. 
Don't forget gtest.h, which declares the testing framework.                                                   
**************************************************************************/
#include "gtest/gtest.h"
#include "include/pf_errno.h"


/**************************************************************************
Step 2. Use test fixture to design your complex cases. 
You can add SetUp() to initialize the test data and 
TearDown() to clear the test data for common usage
Pls remember that when you using test fixture, need to use macro "TEST_F" instead of "TEST"                                                 
**************************************************************************/
class PfErrnoTest : public testing::Test 
{
    /* This SetUp() will be called before every TEST CASE which is marked by macro "TEST_F" */
    virtual void SetUp() 
    {

    }

    /* This TearDown will be called after every TEST CASE which is marked by macro "TEST_F" */
    virtual void TearDown() 
    {

    }

};

/***************************************************************************
Step 3. Use macro "TEST_F" to start your test case                                      
You can design your test case as the example
***************************************************************************/
TEST_F(PfErrnoTest, pf_strerror)
{
    const char* str1 = pf_strerror(PF_EPERM);
    const char* str2 = pf_strerror(EPERM);

    EXPECT_STREQ(str1,"Operation not permitted");
    EXPECT_STREQ(str2,"Operation not permitted");
}
TEST_F(PfErrnoTest,pf_errno)
{
    mkdir("/aa",0777);
    int32_t my_errno = pf_errno();
    EXPECT_EQ(my_errno,-EACCES);
}

TEST_F(PfErrnoTest,pf_last_error)
{
    mkdir("/aa",0777);
    const char* my_err_str = pf_last_error();
    EXPECT_STREQ(my_err_str,"Permission denied");
}

